package com.erb.service.llb.impl;

import com.erb.entity.Advertisement;
import com.erb.entity.Notice;
import com.erb.entity.Pager;
import com.erb.mapper.IndexMapper;
import com.erb.service.llb.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class IndexServiceImpl implements IndexService {
	@Autowired
	IndexMapper indexMapper;

	@Override
	public List<Advertisement> findAdvertisement(Boolean isShow) {
		return indexMapper.findAdvertisement(isShow);
	}

	@Override
	public int countNotice() {
		return indexMapper.countNotice();
	}

	@Override
	public List<Notice> findNotice() {
		return indexMapper.findNotice();
	}

	@Override
	public List<Notice> findNoticeWithPage(Pager pager) {
		return indexMapper.findNoticeWithPage((pager.currPage - 1) * pager.pageSize, pager.pageSize);
	}

	@Override
	public Notice findNoticeById(int id) {
		return indexMapper.findNoticeById(id);
	}
}
